package io.renren.modules.managerAppUser.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

import io.renren.modules.managerAppUser.dao.AppUserDao;
import io.renren.modules.managerAppUser.entity.AppUserEntity;
import io.renren.modules.managerAppUser.service.AppUserService;



@Service("appUserService")
public class AppUserServiceImpl implements AppUserService {
	@Autowired
	private AppUserDao appUserDao;
	
	@Override
	public AppUserEntity queryObject(String id){
		return appUserDao.queryObject(id);
	}
	
	@Override
	public List<AppUserEntity> queryList(Map<String, Object> map){
		return appUserDao.queryList(map);
	}
	
	@Override
	public int queryTotal(Map<String, Object> map){
		return appUserDao.queryTotal(map);
	}
	
	@Override
	public void save(AppUserEntity appUser){
		appUserDao.save(appUser);
	}
	
	@Override
	public void update(AppUserEntity appUser){
		appUserDao.update(appUser);
	}
	
	@Override
	public void delete(String id){
		appUserDao.delete(id);
	}
	
	@Override
	public void deleteBatch(String[] ids){
		appUserDao.deleteBatch(ids);
	}

    @Override
    public void audtiAppUser(AppUserEntity appUserEntity) {
        appUserDao.auditAppUser(appUserEntity);
        //TODO 积分申请和消息推送
//        if("1".equals(appUserEntity.getShzt())){
//            try{
//                String userid = appUserEntity.getUserid();
//                //发送积分申请
//                HttpRequest.sendPost(HzopConstant.dataServiceUrl + "dataservice/api/operatePoints.do",
//                        "userid="+userid+"&type=1002");
//                System.out.println("升级VIP赠积分成功");
//            }catch(Exception e){
//                System.out.println("升级VIP赠积分失败");
//            }
//        }else{
//            //推送信息
//            String userId = appUserEntity.getUserid();
//            MessageDto messageDto = new MessageDto(userId, appUserEntity.getOpinion(), "1", "VIP审核未通过");
//            PushMsgUtil.addMsgAndPush(messageDto);
//        }
    }

    @Override
    public List<Map<String, Object>> queryMapList(Map<String, Object> params) {
	    return appUserDao.queryMapList(params);
    }

}
